from selenium import webdriver
from selenium.webdriver.common.by import By
import time

class TestCase:
    def __init__(self):
        # 打开游览器
        self.driver = webdriver.Chrome()

    def get_so(self):
        # 打开网址
        self.driver.get('https://www.so.com')
        # 输入关键字
        self.driver.find_element(By.ID,'input').send_keys('天气预报')
        # 点击搜素
        self.driver.find_element(By.ID,'search-button').click()

    def quit(self):
        # 关闭游览器
        time.sleep(2)
        self.driver.quit()

if __name__ == '__main__':
    tc = TestCase()
    tc.get_so()
    tc.quit()